package ma.xin.shi.configurations.serviceMerge;

import java.util.ArrayList;
import java.util.List;

public class ServiceConfigMergeCase {
    private final List<ServiceEntryMergeCase> services = new ArrayList<>();

    public void addService(ServiceEntryMergeCase service) {
        services.add(service);
    }

    public List<ServiceEntryMergeCase> getAllServices() {
        return services;
    }

    public ServiceEntryMergeCase getServiceByName(String name) {
        return services.stream()
                .filter(s -> s.getServiceName().equals(name))
                .findFirst()
                .orElse(null);
    }

    public boolean removeService(String name) {
        return services.removeIf(s -> s.getServiceName().equals(name));
    }

    public void clearAllServices() {
        services.clear();
    }
}
